package org.anti996.bankms.controller;

import java.util.Stack;

public class Navigator {
    private static final Stack<ControllerBase> controllers_ = new Stack<>();

    public static void execute() {
        while (true) {
            if (controllers_.empty()) {
                return;
            }
            controllers_.peek().deal();
        }
    }

    public static void push(ControllerBase controller) {
        controllers_.push(controller);
    }

    public static void pop() {
        if (!controllers_.empty()) controllers_.pop();
    }

    public static void terminate() {
        controllers_.clear();
    }
}
